package com.fishery.base.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fishery.base.entity.Catch;
import com.fishery.base.entity.vo.TraceCatchRecordVo;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface CatchMapper extends BaseMapper<Catch> {
	/**
	 * 分页查询捕捞记录的数据
	 *
	 * @param baseId
	 * @param offset
	 * @param size
	 * @return
	 */
	List<Catch> selectCatchRecordsWithPage(@Param("baseId") String baseId, @Param("offset") int offset, @Param("size") int size);

	/**
	 * 查询总记录数
	 *
	 * @param baseId
	 * @return
	 */
	int selectTotal(String baseId);

	/**
	 * 减少捕捞记录的数量和重量
	 *
	 * @param id
	 * @param amount
	 * @param weight
	 * @return
	 */
	int decreaseAmountAndWeight(@Param("id") String id, @Param("amount") Integer amount, @Param("weight") Double weight);

	/**
	 * 增加捕捞记录的数量和重量
	 *
	 * @param id
	 * @param amount
	 * @param weight
	 * @return
	 */
	int increaseAmountAndWeight(@Param("id") String id, @Param("amount") Integer amount, @Param("weight") Double weight);

	/**
	 * 通过id查询捕捞记录（尽管已经删除的也会被查出来）
	 *
	 * @param id
	 * @return
	 */
	TraceCatchRecordVo findCatchRecordByIdEvenDelete(String id);
}
